package cn.signalpha.modules.shop.dto;

import cn.signalpha.core.swagger.ApiModelPropertyEnum;
import cn.signalpha.modules.shop.entity.enums.PublicityTypeEnum;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;

import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
import java.io.Serializable;
import java.util.Date;
import java.util.List;

/**
 * 数据传输对象实体类
 *
 * @author signalpha
 */
@Data
@ApiModel(value = "PublicityDTO对象", description = "营销推广")
public class PublicityDTO implements Serializable {
    private static final long serialVersionUID = 1L;

	/**
	 * 保存
	 */
	@Data
	public static class SaveDTO implements Serializable {
		private static final long serialVersionUID = 1L;
		@ApiModelProperty(value = "商户id")
		private Long sellerId;
		@NotNull
		@ApiModelProperty(value = "类型")
		@ApiModelPropertyEnum(PublicityTypeEnum.class)
		private String type;
		@NotBlank
		@ApiModelProperty(value = "标题")
		private String title;
		@ApiModelProperty(value = "排序值")
		private Integer sort;
		@ApiModelProperty(value = "配置")
		private String config;
		@ApiModelProperty(value = "活动说明")
		private String remark;
		@NotNull
		@ApiModelProperty(value = "开始时间")
		private Date beginTime;
		@NotNull
		@ApiModelProperty(value = "结束时间")
		private Date endTime;
		@ApiModelProperty(value = "是否可以使用优惠券")
		private Integer isCoupon;
	}

	/**
	 * 更新
	 */
	@Data
	public static class UpdateDTO implements Serializable {
		private static final long serialVersionUID = 1L;
		@NotNull
		@ApiModelProperty(value = "主键")
		private Long id;
		@NotBlank
		@ApiModelProperty(value = "标题")
		private String title;
		@ApiModelProperty(value = "排序值")
		private Integer sort;
		@ApiModelProperty(value = "配置")
		private String config;
		@ApiModelProperty(value = "活动说明")
		private String remark;
		@ApiModelProperty(value = "是否可以使用优惠券")
		private Integer isCoupon;
	}

	/**
	 * N元N件配置
	 */
	@Data
	public static class NMoneyNPiecePDTO implements Serializable {
		private static final long serialVersionUID = 1L;
		@ApiModelProperty(value = "多少钱")
		private Double money;
		@ApiModelProperty(value = "多少件")
		private Integer spec;
	}

	/**
	 * 满减活动配置
	 */
	@Data
	public static class fullSubFullDiscountDTO implements Serializable {
		private static final long serialVersionUID = 1L;
		@ApiModelProperty(value = "优惠方式：1阶梯优惠 2循环优惠")
		private Integer pattern;
		@ApiModelProperty(value = "满多少")
		private Double fullHowMany;
		@ApiModelProperty(value = "减多少")
		private Double subHowMany;
		@ApiModelProperty(value = "最多减多少")
		private Double maxHowMany;
		@ApiModelProperty(value = "阶梯优惠列表")
		private List<fullSubFullDiscountDetailDTO> detailList;
	}
	@Data
	public static class fullSubFullDiscountDetailDTO implements Serializable {
		private static final long serialVersionUID = 1L;
		@ApiModelProperty(value = "满多少")
		private Double fullHowMany;
		@ApiModelProperty(value = "减多少")
		private Double subHowMany;
	}

}
